# 2 digit numerator and denominator
# with at least a common digit
# and non trivial
#
# a/b non trivial:
#   a < b
#
# Case 1:
#   a/b = ax / bx
#   a/b = (10*a + x) / (10*b + x)
#   10*a*b + a*x = 10*a*b + b*x
#   a = b or x = 0 -> Impossible
#
# Case 2:
#   a/b = xa / xb
#   a/b = (10*x + a) / (10*x + b)
#   10*a*x + a*b = 10*b*x + a*b
#   a = b or x = 0 -> Impossible
#
# Case 3:
#   a/b = xa / bx
#   a/b = (10*x + a) / (10*b + x)
#   10*a*b + a*x = 10*b*x + a*b
#   9*a*b + a*x = 10*b*x
#
# Case 4:
#   a/b = ax / xb
#   a/b = (10*a + x) / (10*x + b)
#   10*a*x + a*b = 10*a*b + b*x
#   10*a*x = 9*a*b + b*x
#

import lib.integer


def Solve():
    num = 1
    den = 1
    for a in xrange(1, 10):
        for b in xrange(a+1, 10):
            for x in xrange(10):
                if 9*a*b + a*x == 10*b*x:
                    num *= 10*x + a
                    den *= 10*b + x
                if 9*a*b + b*x == 10*a*x:
                    num *= 10*a + x
                    den *= 10*x + b
    return den / lib.integer.Gcd(num, den)

